<?php
require_once('../../controller/auth.php');
//Start session
	session_start();
	
	//Include database connection details
	require_once('../../controller/inc/config.inc');
	
	
	
	//Connect to mysql server
	$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
	if(!$link) {
		die('Failed to connect to server: ' . mysql_error());
	}
	
	//Select database
	$db = mysql_select_db("ttc_teachers");
	if(!$db) {
		die("Unable to select database");
	}
$prov=$_POST['pro'];
$tp=$_POST['tp'];

mysql_query ('SET NAMES utf8');
mysql_query('SET CHARACTER_SET utf8');

echo "<h5>In this selected TTC:</h5>";
$qcm=mysql_query("SELECT TTC_TYPE,COUNT(*) FROM ttc_information WHERE PROV_ID='$prov' AND TTC_TYPE='$tp' group by TTC_TYPE");
$qtn=mysql_query("SELECT * FROM ttc_information WHERE PROV_ID='$prov' AND TTC_TYPE='$tp'");
switch($tp){
case 'اساسی':
$tp='Main TTC';
break;

case 'مرکزحمایوی':
$tp='Satelite TTC';
break;
case 'الحاقیه':
$tp='Sub TTC';
}
echo "<table class='table table-bordered' style='width:50%'>";
while($qcm_row=mysql_fetch_array($qcm)){
echo "<th class='success'>NO of " . $tp . ":</th><td class='success'>" . $qcm_row[1] . "</td>";
echo "</tr>";
$counter++;
}	


	if($qtn){
		echo "<table class='table table-bordered'>";
		echo "<tr><th>TTC Name</th><th>TTC Type</th><th>TTC Status</th><th>TTC Location</th>";
		while($qtn_row=mysql_fetch_array($qtn)){
		echo "<tr>";
		echo "<td>" . $qtn_row['TTC_NAME'] . "</td><td>" . $qtn_row['TTC_TYPE'] . "</td><td>" .  $qtn_row['TTC_STATUS'] . "</td><td>" .  $qtn_row['TTC_LOCATION'] . "</td>";
		echo "</tr>";
		
		}
		echo "</tr>";
		
		}
	

?>